<template>
  <div>
    <div class="container">
      <!-- <div class="header">
        <div class="caption">七猫小说</div>

        <router-link tag="div" to="/PersonalCenter" class="person">
          <svg
            t="1666604129353"
            class="icon"
            viewBox="0 0 1024 1024"
            version="1.1"
            xmlns="http://www.w3.org/2000/svg"
            p-id="5365"
            width="200"
            height="200"
          >
            <path
              d="M656.07 492.812a266.713 266.713 0 1 0-284.302 0C176.37 554.853 41.734 748.972 41.734 991.38a31.98 31.98 0 1 0 63.96 0c0-261.276 174.61-458.593 406.466-458.593S918.306 730.743 918.306 991.38a31.98 31.98 0 0 0 63.96 0c0-240.81-133.037-434.288-326.196-498.568zM311.965 266.713a202.753 202.753 0 1 1 202.753 202.754 203.073 203.073 0 0 1-202.753-202.754z"
              p-id="5366"
              fill="#2c2c2c"
            ></path>
          </svg>
        </router-link>
      </div> -->

      <!-- <div class="nav">
        <router-link tag="a" to="/RecommendView">推荐</router-link>
        <router-link tag="a" to="/ClassifyView">分类</router-link>
        <router-link tag="a" to="/SearchView">搜索</router-link>
        <router-link tag="a" to="/TransLation">书架</router-link>
      </div> -->

      <BannerVue></BannerVue>

      <div class="publicbox" v-for="(item,index) in lists" :key="index" >
        <div class="title">
          <a href="#">{{item.title}}</a>
          <a href="#"
            >{{item.channel}}
          </a>
        </div>

        <div class="module-body">
          <div class="book-media" @click="aaa(item)">
            <div class="imgbox">
              <img :src="item.book.img" alt="" />
            </div>
            <div class="textbox">
              <h3>{{item.book.title}}</h3>
              <p class="summary">
                {{item.book.nav}}
              </p>
              <div class="b-info">
                <span class="b-num"> {{item.book.auother}}</span>
                <span class="b-cate"><em> {{item.book.type}}</em></span>
              </div>
            </div>
          </div>

          <ul>
            <router-link tag="li" to="/FictionContent" v-for="(i,x) in item.book.style" :key="x">
              <div class="txt">{{i.kind}}</div>
              <div class="txt">{{i.name}}</div>
            </router-link>
       
          </ul>
        </div>
      </div>


      <div class="footer">
        <p class="link">
          <a href="">小说首页</a>
          <span>|</span>
          <a href="https://a.app.qq.com/o/simple.jsp?pkgname=com.kmxs.reader"
            >手机客户端</a
          >
          <span>|</span>
          <a href="#xtopjsinfo" class="go_top">返回顶部</a>
        </p>

        <p class="link">
          <a href="">问题反馈</a>
          <span>|</span>
          <a href="#xtopjsinfo" class="go_top">版权声明</a>
        </p>

        <p class="link">
          <a href="">若发现不良信息,请您告知客服,客服QQ:3284839587</a>
        </p>

        <p class="link">
          <a href="">
            <i> 版权所有 ©km.com All Rights Reserved</i> 沪ICP备16039144号-1</a
          >
        </p>
      </div>
    </div>
  </div>
</template>

<script>
import {getJsonData} from "../api/home.js"

import BannerVue from "../components/BannerVue.vue";
export default {

  data(){
    return {
      lists:null,
      list:[]
    };
  },
  created(){
     if(!JSON.parse(window.localStorage.getItem("list"))){
      window.localStorage.setItem("list",JSON.stringify([]))

     }else{
      this.list = JSON.parse(window.localStorage.getItem("list"))
     }
    getJsonData().then(data=>{
      // console.log(data);
      // console.log(data.home)
      this.lists=data.home;
    })
  },

  methods:{
    aaa(item){
      this.list = item
      // console.log("s ");
      window.localStorage.setItem("list",JSON.stringify(this.list))
      this.$router.push("/DetailView")
    }
  },


  components: {
    BannerVue,
  },
};
</script>

<style lang="scss">
.container {
  background-color: #f5f5f5;
  .nav {
    display: flex;
    justify-content: space-around;
    background-color: #ffda33;
    a {
      height: 40px;
      line-height: 40px;
      justify-content: space-around;
      font-size: 18px;
      color: #666666;
      padding: 0 16px;
    
    }
    // .con{
    //     color: #ff9744;
    //   border-bottom: 2px solid #ff9744;
    // }
    .router-link-active {
      color: #ff9744;
      border-bottom: 2px solid #ff9744;
    }
  }

  .header {
    height: 58px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    // padding-top: 2px;
    background-color: #ffffff;
    padding-left: 14px;
    padding-right: 14px;
    // margin-right: 10px;

    .caption {
      font-size: 20px;
      font-weight: bold;
      color: #000;
    }

    .person {
      width: 20px;
      height: 20px;
      .icon {
        width: 20px;
        height: 20px;
      }
    }

   
  }
  .publicbox {
    background-color: #ffffff;
    margin-bottom: 10px;
  }
  .footer {
    margin-top: 34px;
    background-color: #ffffff;
    padding-top: 2px;
    .link {
      display: flex;
      justify-content: center;
      margin: 6px 6px;
      a {
        color: #999999;
        font-size: 14px;
      }
      i {
        color: #999999;
        font-size: 10px;
      }
      span {
        margin: 0 7px;
        color: #999999;
        font-size: 12px;
        list-style: none;
      }
      &:nth-child(4) {
        padding-top: 6px;
        padding-bottom: 14px;
      }
    }
  }
}
.publicbox {
  .title {
    display: flex;
    padding-right: 22px;
    padding-left: 22px;
    justify-content: space-between;
    padding-top: 5px;
    a {
      height: 30px;
      line-height: 30px;
      font-weight: normal;
      &:nth-child(1) {
        font-size: 20px;
        color: #ff8800;
      }
      &:nth-child(2) {
        font-size: 16px;
        color: #999999;
      }
    }
  }
}
a {
  .icon {
    width: 14px;
    height: 14px;
    color: #999999;
    padding-left: 2px;
  }
}
.module-body {
  .book-media {
    display: flex;
    padding: 22px 22px;
    justify-content: space-between;
    .imgbox {
      img {
        width: auto;
        height: 92px;
      }
    }
    .textbox {
      display: flex;
      height: 78px;
      flex-direction: column;
      margin-left: 16px;
      h3 {
        font-size: 16px;
        color: #333333;
        font-weight: normal;
      }
      p {
        font-size: 14px;
        color: #999999;
        margin: 7px 0;
      }
    }
  }
  ul {
    li {
      display: flex;
      padding: 0 22px;
      .txt {
        height: 46px;
        line-height: 46px;
        &:nth-child(2) {
          padding-left: 10px;
          color: #333333;
        }
        &:nth-child(1) {
          color: #999999;
        }
      }
    }
  }
}

.b-info {
  display: flex;
  justify-content: space-between;
  .b-num {
    font-size: 13px;
    color: #999999;
  }
  .b-cate {
    font-size: 12px;
    color: #999999;
    border: 1px solid #e2e2e2;
    padding: 0 2px;
  }
}
</style>